<!-- 通信类 决算  结决算审核信息 -->
<template>
  <TCollapse title="结决算审核信息">
    <div ref="queryFormBox" class="search-flex-box">
      <BtnConfig ref="btnConfigRef" class="marginBottom14" :btn-configs="btnOptionOne" @propClick="btnClick" />
      <Form
        ref="formRef"
        v-model="reviewInformationList"
        :form-option="formOption"
        :select-list="dicLists"
      />
    </div>
  </TCollapse>
</template>

  <script>
  import Form from '@/views/actualBudget/communication/tFbusiness/pmsForm'
  import TCollapse from '@/components/basic/TCollapse.vue'
  import BtnConfig from '@/components/basic/btnConfig.vue'
  import { newOpenPostWindow } from '@/utils/newRequestCommonFormjs'
  import { getForeignConfig, queryAuditButton } from '@/api/actualBudget/tFbusiness'
  import { getUserInfo, applyTokenByCode } from '@/api/businessOperation/index' // 列表接口
  // 查询条件配置
  const formOption = {
      size: 'mini',
      inline: true,
      labelWidth: '160px',
      itemData: [
          {
              type: 'input',
              prop: 'jisSubTime',
              value: '',
              width: '',
              colSpan: 6,
              clearable: true,
              disabled: true,
              label: '结算送审时间'
          },
          {
              type: 'input',
              prop: 'jisAppTime',
              value: '',
              width: '',
              colSpan: 6,
              clearable: true,
              disabled: true,
              label: '结算审定时间'
          },
          {
              type: 'input',
              prop: 'jisAppInvest',
              value: '',
              width: '',
              colSpan: 6,
              clearable: true,
              disabled: true,
              label: '结算审定金额'
          },
          {
              type: 'input',
              prop: 'jusSubTime',
              value: '',
              width: '',
              colSpan: 6,
              clearable: true,
              disabled: true,
              label: '决算送审时间'
          },
          {
              type: 'input',
              prop: 'jusAppTime',
              value: '',
              width: '',
              colSpan: 6,
              clearable: true,
              disabled: true,
              label: '决算审定时间'
          },
          {
              type: 'input',
              prop: 'jusAppInvest',
              value: '',
              width: '',
              colSpan: 6,
              clearable: true,
              disabled: true,
              label: '决算审定金额'
          }
      ]
  }

  // 列表按钮配置
  // const btnOptionOne = [
  //     // { label: '采购订单清单表导出', fun: 'exportData', type: '' },
  //     { label: '结算审计进度', fun: 'redirceJiSAUD', type: '' },
  //     { label: '决算审计进度', fun: 'redirceJSAUD', type: '' }
  // ]

  export default {
      name: 'ActualTime',
      components: {
          BtnConfig,
          Form,
          TCollapse
      },
      props: {
          reviewInformationList: {
              type: Object,
              default: () => ({})
          },
          urlList: {
              type: Object,
              default: () => ({})
          },
          lcList: {
              type: Object,
              default: () => ({})
          },
          basicList: {
              type: Object,
              default: () => ({})
          }
      },
      data() {
          return {
              // btnOptionOne,
              formOption, // 查询条件配置项
              dialogCheckbox: false, // 自定义列表弹框
              dicLists: {}, // 下拉框字典选项集合3
              btnOptionOne: []
          }
      },
      watch: {
          basicList: {
              handler(newValue, oldValue) {
                  this.showButton(newValue)
              },
              deep: true,
              immediate: true
          }
      },
      created() {
          console.log('created --------------------')
      },
      methods: {
          async showButton(basicList) {
              const { prjId } = basicList
              console.log(this.basicList, 'info')
              if (prjId !== null && prjId !== undefined) {
                  const ifShowBtnData = await queryAuditButton({ prjId: prjId })
                  console.log(ifShowBtnData, '----------------ifShowBtn')
                  var ifShowBtn = ifShowBtnData.data
                  if (ifShowBtn === '1' || ifShowBtn === '3') {
                      this.btnOptionOne.push({ label: '结算审计进度', fun: 'redirceJiSAUD', type: '' })
                  }
                  if (ifShowBtn === '2' || ifShowBtn === '3') {
                      this.btnOptionOne.push({ label: '决算审计进度', fun: 'redirceJSAUD', type: '' })
                  }
              }
          },
          // 列表按钮点击事件
          btnClick(fun, row) {
              this[fun](row)
          },
          async redirceParam() {
              const userObj = await getUserInfo({ })
              const applyTokenByCodeData = await applyTokenByCode({ serviceId: 'CHNTAUD', loginAcct: userObj.data.user.loginName })
              var params = {}
              if (applyTokenByCodeData.code === '200') {
                  var applyTokenByCodeList = applyTokenByCodeData.data
                  var pwdaToken = applyTokenByCodeList.TOKEN
                  var acctId = applyTokenByCodeList.ACCTID
                  params.pwdaToken = pwdaToken
                  params.acctId = acctId
              //   params.UserCode = userInfo.user.loginName
                  params.prjCode = this.basicList.prjCode
                //   params.prjCode = '16A13SDYT201114'
              }

              return params
          },
          async redirceJiSAUD() {
              var params = await this.redirceParam()
              if (params != null) {
                const foreignObj = await getForeignConfig({ itfCodeStatus: 'AUDIT' })
                var toUrl = ''
                if (foreignObj.code === '200') {
                    console.log(foreignObj, '------------')
                    var foreignData = foreignObj.data
                    toUrl = foreignData.servUrl
                }
                // 2024-11-21 跳转页面使用post方式
                toUrl = toUrl + '/base/api/jumpToAudit/ActualizeDetailForPms'
                console.log(toUrl, params, 'JistoUrlparams----')
                newOpenPostWindow(toUrl, params)
              }
          },
          async redirceJSAUD() {
            var params = await this.redirceParam()
              if (params != null) {
                const foreignObj = await getForeignConfig({ itfCodeStatus: 'AUDIT' })
                var toUrl = ''
                if (foreignObj.code === '200') {
                    console.log(foreignObj, '------------')
                    var foreignData = foreignObj.data
                    toUrl = foreignData.servUrl
                }
                // 2024-11-21 跳转页面使用post方式
                toUrl = toUrl + '/base/api/jumpToAudit/JueDrawFormForPms'
                console.log(toUrl, params, 'JstoUrlparams----')
                newOpenPostWindow(toUrl, params)
              }
          }
      }
  }
  </script>

    <style lang="scss" scoped>
  .search-flex-box {
      // display: flex;
      // justify-content: space-between;
      height: auto;
  }

  .searchBtn {
      width: 100px;
      margin-left: auto;
      display: flex;
      margin-top: 4px;
      flex-direction: column;

      .el-button + .el-button {
          margin-left: 0;
          margin-top: 8px;
      }
  }

  .electronicSignature {
      width: 100%;

      .mainDetails {
          padding: 20px 25px 0px;
      }

      .topRemark {
          // background-color: #fdf5e6;
          background-color: #ffefd5;
          width: 100%;
          height: 40px;
          line-height: 40px;
          padding-left: 10px;
          font-size: 14px;

          .asterisk {
              color: #f00;
              margin-right: 2px;
              font-size: 18px;
          }
      }

      .customBtn {
          height: 20px;
          line-height: 20px;
          font-size: 14px;
          margin: 10px 20px 10px 90%;
          cursor: pointer;

          .el-icon-s-tools {
              font-size: 20px;
              color: #999;
              margin-right: 6px;
          }
      }
  }

  .el-button--text {
      color: #02a7f0;
  }

  .el-button--primary {
      color: #fff;
  }

  .dialog-footer {
      display: flex;
      justify-content: center;
  }

  ::v-deep .el-button + .el-button {
      color: #fff;
  }

  // 弹框样式
  ::v-deep .el-dialog__body {
      max-height: 400px;
      overflow-y: auto;
      margin: 0px;
  }

  // 滚动条样式
  ::v-deep .el-dialog__body::-webkit-scrollbar {
      // 滚动条整体样式
      width: 6px; //高宽分别对应横竖滚动条的尺寸
      height: 10px;
  }

  ::v-deep .el-dialog__body::-webkit-scrollbar-thumb {
      // 滚动条里面小方块
      border-radius: 10px;
      // -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
      background: #f2f3f5;
  }

  ::v-deep .el-range-editor.el-input__inner {
      padding: 0px 10px;
  }

  .topBtn {
      text-align: center;
      padding: 20px;
  }

  ::v-deep .el-tag {
      border: none;
      color: #02a7f0;
      background-color: #ffffff;
  }

  ::v-deep .el-dialog__title {
      font-size: 14px;
      font-weight: bold;
  }

  ::v-deep .el-col-24 {
      height: 110px;
  }

  ::v-deep .el-textarea.is-disabled .el-textarea__inner {
      background-color: #f7f7f7;
  }
  </style>
